home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Games / NeXTmille / Source / GameCoordinator.h < prev    next >
Text File  |  1991-01-11  |  4KB  |  119 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import <objc/Object.h>
  5. #import    <appkit/Text.h>
  6. #import    <appkit/Window.h>
  7. #import    "CardsTracker.h"
  8. #import    "CardHolder.h"
  9. #import    "CardView.h"
  10. #import    "DragCoordinator.h"
  11. #import    "DrawPileStackView.h"
  12. #import    "Player.h"
  13. #import    "StackView.h"
  14.  
  15.  
  16. // Theere is only one game coordinator object.  There is only one game.
  17. //    The game coordinator coordinates the activities between the user and the 
  18. //    players.  This includes new hands, games, and the prompting of the user
  19. //    for information or decisions.
  20.  
  21.  
  22.                                                 // This data type is used to dictate a card class and the
  23.                                                 //    number of instances of that class required for the
  24.                                                 //    deck of cards.
  25.                                                 // cardType is a tag value assigned to each card as it is
  26.                                                 //    created.  It identifies the card type.
  27.     typedef struct _cardDeckCell {    STR        cardClassName;
  28.                                     int        numCards;
  29.                                     int        cardType;
  30.     } cardDeckCell;
  31.     
  32.     extern    cardDeckCell    cardDeck[];
  33.     
  34.     
  35.                                                 // This is the game coordinator.
  36.                                                 //    There is only one instance of this class.
  37. @interface GameCoordinator:Object
  38. {
  39.  
  40.                                                 // All of the objects listed below are set by the .nib
  41.                                                 //    dearchiving method.
  42.     DrawPileStackView        *drawPile;
  43.     StackView                *discardPile;
  44.     Text                    *messagesText;
  45.     Window                    *gameWindow,
  46.                             *scoreWindow,
  47.                             *cardsPlayedWindow;
  48.     Player                    *player,
  49.                             *computerPlayer;
  50.     CardsTracker            *cardsTracker;
  51.                                                 // This    object is stored only so that it can be passed to
  52.                                                 //    each card instance;  Otherwise, it isn't used by this
  53.                                                 //    object.        
  54.     DragCoordinator            *dragCoordinator;
  55.                                                 // This is the distance goal for the current hand.
  56.     int                        handLimit;
  57.                                                 // This flag indicates the computer is playing itself.
  58.                                                 //    It is a menu selection.
  59.     BOOL                    computerVsComputerFlag;
  60.                                                 // This variable holds the last player to
  61.                                                 //    shuffle the deck.  The player to the
  62.                                                 //    dealers left goes first.  So, how does this work?
  63.                                                 // The first shuffler is the player.  Then
  64.                                                 //    we alternate between players.  
  65.     Player                    *lastShuffler;
  66. }
  67.  
  68.                                                 // These methods set the outlets for instances of this
  69.                                                 //    class.
  70. - setMessagesText:( Text * )anObject;
  71. - setDrawPile:( DrawPileStackView * ) anObject;
  72. - setDiscardPile:( StackView * ) anObject;
  73.  
  74.                                                 // Return the windows.
  75. - ( Window * )gameWindow;
  76. - ( Window * )scoreWindow;
  77. - ( Window * )cardsPlayedWindow;
  78.                                                 // The instance of this class is a delegate of the
  79.                                                 //    application object.  This method is used to notify
  80.                                                 //    the coordinator to get things rolling.
  81. - appDidInit:sender;
  82.                                                 // Action message sent by a menu selection.
  83.                                                 //    Chooses computer vs computer.  Displays
  84.                                                 //    a alert panel the sends the play
  85.                                                 //    method to both players until the
  86.                                                 //    alert is canceled.
  87. - computerVsComputer:sender;
  88.  
  89.                                                 // These methods are the game itself.
  90.                                                 // Begin a new game.  Start a new hand.
  91.                                                 //   If either player's score is over the game
  92.                                                 //    limit then prompt to play another game.
  93. - newGame;                                        
  94.                                                 // Begin a new hand.  Total each player's score.
  95.                                                 //    Send all cards back to the draw pile, turn 
  96.                                                 //    them face down, and shuffle the deck.  Deal a new
  97.                                                 //    hand.
  98. - newHand;
  99.                                                 // Shuffle the cards in the draw pile.
  100. - shuffleDeck;
  101.                                                 // The hand limit is extended either by operator
  102.                                                 //    selection or the computer.
  103.                                                 // Many objects want to know the distance goal.
  104. - setHandLimit:( int )aLimit;
  105. - ( int )handLimit;
  106.                                                 // Message comes from player Player object.
  107.                                                 //    It requesting the player for a
  108.                                                 //    game extension.
  109.                                                 // returns TRUE if extension is granted.
  110. - ( BOOL )willPlayerExtend;
  111.                                                 // This method comes from one of the plater
  112.                                                 //    objects when it detects the hand is over.
  113.                                                 // This method will either initiate a new hand
  114.                                                 //    or a new game.
  115. - handOver;
  116.  
  117.  
  118. @end
  119.